
// @include "../code/Browser.js"
// @include "../code/Type.js"
// @include "../code/Array.js"
// @include "../extend/Debug.js"
/**
 * @fileOverview AJAX异步加载工具
 * 
 * @version qinglan_Ajax 1.0
 * @static
 * @author wxq wxqqh@qq.com
 */
/**
 * 命名空间
 * 
 * @namespace
 * @type Object
 */
window.qinglan = window.qinglan || {};
/**
 * AJAX异步加载工具命名空间
 * 
 * @namespace
 * @type Object
 */
qinglan.Ajax = qinglan.Ajax || {};

qinglan.Ajax.get = function(url, callback) {
	var xhr = new XMLHttpRequest();
	xhr.onreadystatechange = function() {
		if (xhr.readyState === 4) {
			var error;
			if (xhr.status !== 200 && xhr.status !== 0) {
				error = "Invalid XHR status " + xhr.status;
			} else if (xhr.responseText === "") {
				error = "No content";
			}
			callback(xhr.responseText, error);
		}
	};
	xhr.open("GET", url, true);
	if (xhr.overrideMimeType) {
		xhr.overrideMimeType("application/json");
	}
	xhr.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT"); // no
	// cache
	xhr.send(null);
};